implement more of N4258 - Cleaning up noexcept in the standard library. Specifically add new noexcept stuff to vector and string's move-assignment operations git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245330 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/vector b/include/vector index 049d3c8..1cafae1 100644 --- a/include/vector +++ b/include/vector
@@ -51,8 +51,8 @@ vector& operator=(const vector& x); vector& operator=(vector&& x) noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); + allocator_type::propagate_on_container_move_assignment::value || + allocator_type::is_always_equal::value); // C++17 vector& operator=(initializer_list<value_type> il); template <class InputIterator> void assign(InputIterator first, InputIterator last); @@ -175,8 +175,8 @@ vector& operator=(const vector& x); vector& operator=(vector&& x) noexcept( - allocator_type::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); + allocator_type::propagate_on_container_move_assignment::value || + allocator_type::is_always_equal::value); // C++17 vector& operator=(initializer_list<value_type> il); template <class InputIterator> void assign(InputIterator first, InputIterator last); @@ -562,9 +562,7 @@ vector(vector&& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) - _NOEXCEPT_( - __alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); + _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY @@ -787,7 +785,8 @@ void __move_range(pointer __from_s, pointer __from_e, pointer __to); void __move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); - void __move_assign(vector& __c, false_type); + void __move_assign(vector& __c, false_type) + _NOEXCEPT_(__alloc_traits::is_always_equal::value); _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT { @@ -1303,9 +1302,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& vector<_Tp, _Allocator>::operator=(vector&& __x) - _NOEXCEPT_( - __alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value) + _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); @@ -1315,6 +1312,7 @@ template <class _Tp, class _Allocator> void vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) + _NOEXCEPT_(__alloc_traits::is_always_equal::value) { if (__base::__alloc() != __c.__alloc()) { @@ -2213,9 +2211,7 @@ vector(vector&& __v, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v) - _NOEXCEPT_( - __alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value); + _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY @@ -2838,9 +2834,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<bool, _Allocator>& vector<bool, _Allocator>::operator=(vector&& __v) - _NOEXCEPT_( - __alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value) + _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) { __move_assign(__v, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());